import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ElementUI from 'element-ui'
import api from "./utils/request"
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI)
Vue.use(router)
Vue.config.productionTip = false
Vue.prototype.$api = api

// 全局拖拽事件
Vue.directive('drag', {
  bind: function (el) { },
  inserted: function (el) {
    el.onmousedown = function (e) {
      var disx = e.clientX - el.offsetLeft;
      var disy = e.clientY - el.offsetTop;
      document.onmousemove = function (e) {
        el.style.left = e.clientX - disx + 'px';
        el.style.top = e.clientY - disy + 'px';
      }
      document.onmouseup = function () {
        document.onmousemove = document.onmouseup = null;
      }
    }
  },
  updated: function (el) { }
})
new Vue({
  router,
  render: h => h(App),
}).$mount('#app')
